package cn.gz.demo.ui;


import android.os.Bundle;

import androidx.databinding.DataBindingUtil;

import cn.gz.demo.CircleBinding;
import cn.gz.demo.R;
import cn.gz.demo.ui.base.BaseActivity;


/**
 * Created by Liuyz on 2018/7/5.
 */

public class CircleActivity extends BaseActivity {
    private CircleBinding binding;
    private int mTotalProgress = 100;
    private int mCurrentProgress = 0;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        binding = DataBindingUtil.setContentView(this, R.layout.activity_circle);

        binding.iv1.setBackgroundResource(R.drawable.soild_circle_shape);
        binding.iv2.setBackgroundResource(R.drawable.empty_circle_shape);
        new Thread(new ProgressRunable()).start();

    }

    class ProgressRunable implements Runnable {
        @Override
        public void run() {
            while (mCurrentProgress < mTotalProgress) {
                mCurrentProgress += 1;
                binding.iv3.setProgress(mCurrentProgress);
                try {
                    Thread.sleep(100);
                } catch (Exception e) {
                    e.printStackTrace();
                }
            }
        }
    }
}
